package com.xdja.myapplication

import android.os.Bundle
import android.transition.TransitionManager
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintSet
import kotlinx.android.synthetic.main.activity_constraint_anim_1.*

class ConstraintAnimActivity : AppCompatActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_constraint_anim_1)
        button.setOnClickListener {
            animateToLayout2()
        }
    }


    private fun animateToLayout2() {
        val constraintSet = ConstraintSet()
        constraintSet.load(this,R.layout.activity_constraint_anim_2)
        TransitionManager.beginDelayedTransition(constraint_layout)
        constraintSet.applyTo(constraint_layout)
    }
}
